// This is JDefenceTower, a simple tower defence style game
//
// Copyright (C) 2010 Maximilian Junker
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 3 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, see <http://www.gnu.org/licenses/>.

package junker.defence.model;

import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;

public class StepSummary {
	private HashMap<MapObject, MoveRequest>			moveEvents				= new HashMap<MapObject, MoveRequest>();
	private HashMap<MapLocation, List<CreateRequest>>	createEvents			= new HashMap<MapLocation, List<CreateRequest>>();
	private List<CreateRequest>						conflictingCreateEvents	= new LinkedList<CreateRequest>();
	private List<MoveRequest>							conflictingMoveEvents	= new LinkedList<MoveRequest>();
	private int										step;
	private boolean									barrierCreated			= false;
	private boolean									barrierRemoved			= false;
	
	public int getStep() {
		return step;
	}

	public void setStep(int step) {
		this.step = step;
	}

	boolean isBarrierRemoved() {
		return barrierRemoved;
	}

	boolean isBarrierCreated() {
		return barrierCreated;
	}
	
	public void setBarrierCreated(boolean b) {
		this.barrierCreated=b;		
	}

	public boolean containsCreationAt(MapLocation MapLocation) {
		return createEvents.containsKey(MapLocation);
	}

	public List<CreateRequest> getCreationsAt(MapLocation MapLocation) {
		return createEvents.get(MapLocation);
	}

	public void addCreation(MapLocation mapLocation, CreateRequest c) {
		if(!createEvents.containsKey(mapLocation)){
			createEvents.put(mapLocation, new LinkedList<CreateRequest>());
		}
		createEvents.get(mapLocation).add(c);
	}

	public boolean containsMoveFor(MapObject mapObject) {
		return moveEvents.containsKey(mapObject);
	}

	public MoveRequest getMoveFor(MapObject mapObject) {
		return moveEvents.get(mapObject);
	}

	public void replaceMove(MapObject mapObject, MoveRequest m) {
		moveEvents.put(mapObject, m);

	}

	public void addConflictingCreation(CreateRequest c) {
		conflictingCreateEvents.add(c);
	}

	public void addConflictingMove(MoveRequest m) {
		conflictingMoveEvents.add(m);
	}

	public Collection<MoveRequest> getValidMoveEvents() {
		return moveEvents.values();
	}

	public Collection<MoveRequest> getConflictingMoveEvent() {
		return conflictingMoveEvents;
	}

	public Collection<List<CreateRequest>> getValidCreateEvents() {
		return createEvents.values();
	}

	public Collection<CreateRequest> getConflictingCreateEvents() {
		return conflictingCreateEvents;
	}



}
